home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / netbon.zip / NETQUE.PAS < prev    next >
Pascal/Delphi Source File  |  1992-10-02  |  8KB  |  224 lines

  1. {
  2.   Turbo Pascal Unit of Queue Services for NetWare
  3.   Version 1.1  9/5/91
  4.  
  5.   by Richard S. Sadowsky
  6.  
  7.   Please address questions and comments about this unit to ALL in section 6 of
  8.   the PCVENB forum on Compuserve.
  9. }
  10. {$A-,V-,F-}
  11.  
  12. Unit NetQue;
  13.  
  14. interface
  15.  
  16. {$IFDEF Windows}
  17.   {$DEFINE WindowsOrDPMI}
  18. {$ELSE}
  19.   {$IFDEF DPMI}
  20.     {$DEFINE WindowsOrDPMI}
  21.   {$ENDIF}
  22. {$ENDIF}
  23.  
  24. uses
  25. {$IFDEF Windows}
  26.   WinProcs,
  27.   WinTypes,
  28.   WinDos,
  29.   WinDPMI,
  30. {$ELSE}
  31.   Dos,
  32.   {$IFDEF DPMI}
  33.   WinDPMI,
  34.   {$ENDIF}
  35. {$ENDIF}
  36.   NetWare,
  37.   NetBind;
  38.  
  39. const
  40.   MaxQueueJobs         = 250;
  41.   QueueMaxConnections  = 25;
  42.  
  43.   jcfAutoStart         = $08;
  44.   jcfRestart           = $10;
  45.   jcfEntryOpen         = $20;
  46.   jcfUserHold          = $40;
  47.   jcfOperatorHold      = $80;
  48.  
  49. {$IFDEF Windows}
  50. type
  51.   Registers            = TRegisters;
  52. {$ENDIF}
  53.  
  54. type
  55.   JobFileNameStr       = String[13];
  56.   QueuePathType        = String[118];
  57.   QMSDateTime          = record
  58.                            Y,M,D,H,Min,S : Byte;
  59.                          end;
  60.   QueueJobList         = record
  61.                            NumJobs : Word;
  62.                            JobList : Array[1..MaxQueueJobs] of Word;
  63.                          end;
  64.   JobFileHandleType    = Array[1..6] of Byte;
  65.   QueueTimeType        = Array[1..6] of Byte;
  66.   TextJobField         = Array[1..50] of Char;
  67.   TextJobStr           = String[49];
  68.   ClientRecordArea     = Array[1..152] of Byte;
  69.   QueueServerIDList    = Array[1..QueueMaxConnections] of LongInt;
  70.   QueueStationList     = Array[1..QueueMaxConnections] of Byte;
  71.   JobEntryType         = record
  72.                            ClientStation    : Byte;
  73.                            ClientTaskNum    : Byte;
  74.                            ClientID         : LongInt;      {hi-lo}
  75.                            TargetServerID   : LongInt;      {hi-lo}
  76.                            TargetExecTime   : QMSDateTime;
  77.                            JobEntryTime     : QMSDateTime;
  78.                            JobNumber        : Word;         {hi-lo}
  79.                            JobType          : Word;         {hi-lo}
  80.                            JobPosition      : Byte;
  81.                            JobControlFlags  : Byte;
  82.                            JobFileName      : JobFileNameStr;
  83.                            JobFileHandle    : JobFileHandleType;
  84.                            ServerStation    : Byte;
  85.                            ServerTaskNum    : Byte;
  86.                            ServerID         : LongInt;      {hi-lo}
  87.                            TextJobDesc      : TextJobField;
  88.                            ClientRecord     : ClientRecordArea;
  89.                          end;
  90.   ServerStatusRecord   = Array[1..64] of Byte;
  91.  
  92. const
  93.   SubFAbortServicingJob= $73;
  94.   SubFAttachQueServ    = $6F;
  95.   SubFChangeJobPos     = $6E;
  96.   SubFChangeJobEntry   = $6D;
  97.   SubFChangeToClient   = $74;
  98.   SubFCloseAndStart    = $69;
  99.   SubFCreateQue        = $64;
  100.   SubFCreateJobAndFile = $68;
  101.   SubFDestroyQue       = $65;
  102.   SubFDetachFromQue    = $70;
  103.   SubFFinishServicing  = $72;
  104.   SubFGetJobFileSize   = $78;
  105.  
  106.   SubFGetJobList       = $6B;
  107.   SubFReadCurStatus    = $66;
  108.   SubFReadJobEntry     = $6C;
  109.   SubFReadQueServStatus= $76;
  110.   SubFRemJobFromQue    = $6A;
  111.   SubFChangeToServer   = $75;
  112.   SubFServiceJob       = $71;
  113.   SubFReadQueStatus    = $67;
  114.   SubFSetStatusRec     = $77;
  115.  
  116. var
  117.   FirstOpportunity     : QMSDateTime;
  118.  
  119. function AbortServicingQueueJob(QueueID : LongInt; JobNum : Word) : Byte;
  120.   {-Abort servicing a job, close the associated file, amd remove job entry
  121.     from Queue}
  122.  
  123. function AttachQueueServerToQueue(QueueID : LongInt) : Byte;
  124.   {-Attaches a station to a queue as a queue (job) server}
  125.  
  126. function ChangeQueueJobEntry(QueueID : LongInt;
  127.                              var JobEntry : JobEntryType) : Byte;
  128.   {-Change's information in the job's record entry}
  129.  
  130. function ChangeQueueJobPosition(QueueID : LongInt; JobNumber : Word;
  131.                                 NewPosition : Byte) : Byte;
  132.   {-Changes a job's position in the queue}
  133.  
  134. function ChangeToClientRights(QueueID : LongInt; JobNumber : Word) : Byte;
  135.   {-Allows a queue (job) server to assume the login identity of the client
  136.     that placed the job in the queue}
  137.  
  138. function CloseFileAndStartJob(QueueID : LongInt; JobNumber : Word) : Byte;
  139.   {-Closes an associated file and releases the job for servicing}
  140.  
  141. function CreateQueue(QueType : Word; QueName : ObjNameStr;
  142.                      DirectoryHandle : Byte; PathName : QueuePathType;
  143.                      var QueueID : LongInt) : Byte;
  144.   {-Creates a new queue on a file server}
  145.  
  146. function CreateQueueJobAndFile(QueueID : LongInt;
  147.                                JobEntry : JobEntryType;
  148.                                var ReplyEntry : JobEntryType) : Byte;
  149.   {-Places a new job in the queue}
  150.  
  151. function DestroyQueue(QueueID : LongInt) : Byte;
  152.   {-Removes a queue from the bindery and file system of a file server}
  153.  
  154. function DetachQueueServerFromQueue(QueueID : LongInt) : Byte;
  155.   {-Removes the requesting station from the queue's list of active queue (job_
  156.     servers}
  157.  
  158. function FinishServicingQueueJob(QueueID : LongInt; JobNumber : Word;
  159.                                  Charge : LongInt) : Byte;
  160.   {-Allows a queue (job) server to signal QMS when it has completed a job}
  161.  
  162. function GetQueueJobList(QueueID : LongInt; var Jobs : QueueJobList) : Byte;
  163.   {-Provides a list of all jobs contained in a queue}
  164.  
  165. function GetQueueJobFileSize(QueueID : LongInt;
  166.                              JobNumber : Word;
  167.                              var SizeOfFile : LongInt) : Byte;
  168.   {-Finds the size of the associated file for a job queue}
  169.  
  170. function ReadQueueCurrentStatus(QueueID : LongInt;
  171.                                 var QueueStatus : Byte;
  172.                                 var NumberOfJobs : Byte;
  173.                                 var NumberOfServers : Byte;
  174.                                 var ServerIDList : QueueServerIDList;
  175.                                 var StationList  : QueueStationList) : Byte;
  176.   {-Reads the current status of the queue}
  177.  
  178. function ReadJobEntry(QueueID : LongInt; JobNumber : Word;
  179.                       var JobEntry : JobEntryType) : Byte;
  180.   {-Retrieves information about jobs in a queue}
  181.  
  182. function ReadQueueServerStatus(QueueID : LongInt; ServerID : LongInt;
  183.                                ServerStation : Byte) : Byte;
  184.   {-Reads the current status record of an attached queue (job) server}
  185.  
  186. function RemoveJobFromQueue(QueueID : LongInt; JobNumber : Word) : Byte;
  187.   {-Removes a job from the queue}
  188.  
  189. function RestoreQueueServerRights : Byte;
  190.   {-Restores a server's own identity after assuming the client's rights}
  191.  
  192. function ServiceQueueJobAndOpenFile(QueueID : LongInt;
  193.                                     TargetJobType : Word;
  194.                                     var JobEntry : JobEntryType) : Byte;
  195.   {-Allows a queue server to request a new job for servicing}
  196.  
  197. function SetQueueCurrentStatus(QueueID : LongInt;
  198.                                QueueStatus : Byte) : Byte;
  199.   {-Controls the addition of jobs and job servers to a queue by setting and
  200.     clearing bits in the queue status byte}
  201.  
  202. function SetQueueServerStatusRecord(QueueID : LongInt;
  203.                                     var StatusRec : ServerStatusRecord) : Byte;
  204.   {-Updates QMS' copy of a queue (job) servers's status record}
  205.  
  206. {high level routines}
  207. function JobSize(QueueID : LongInt; JobNumber : Word;
  208.                  var Size : LongInt) : Byte;
  209.   {-Returns the size of the print data associate with queue QueueID and job
  210.     JobNumber}
  211.  
  212. implementation
  213.  
  214. {$IFDEF WindowsOrDPMI}
  215.   {$I NETQUEW.INC}
  216. {$ELSE}
  217.   {$I NETQUE.INC}
  218. {$ENDIF}
  219.  
  220. begin
  221.   FillChar(FirstOpportunity, SizeOf(FirstOpportunity), $FF);
  222. end.
  223.  
  224.